sql optimization interview question